<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>es6-proxy</title>
  </head>
  <body>
    <script>
      function fn(flag) {
        //构造函数
        return new Promise(function (resolve, reject) {
          if (flag === true) {
            resolve("promise状态为成功！");
          }
          if (flag === false) {
            reject("promise状态失败！");
          }
        });
      }

      console.log(fn(true));
    </script>
  </body>
</html>
